package com.sk.coin.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * @author: SongKun
 * @date: 2021/11/4
 * @Description:
 */
@RestController
public class UserInfoController {


    /**
     * 当前登录的用户对象
     * @param principal
     * @return
     */
    @GetMapping("user/info")
    public Principal userInfo(Principal principal){
        // 使用ThreadLocal
        // Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return principal;
    }

}
